//
//  MyReviewCell.swift
//  willdo
//
//  Created by zz on 3/14/18.
//  Copyright © 2018 will do. All rights reserved.
//

import UIKit
import SnapKit

class MyReviewCell: UITableViewCell {
    
    let bgView = UIImageView()
    let ReviewName = UILabel()
    let ReviewTime = UILabel()
    let ReviewMember = UILabel()
    let ReviewState = UILabel()
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        backgroundColor = UIColor.clear
        self.selectionStyle = .none
        setupCell()
    }
    
    private func setupCell(){
        addSubview(bgView)
        bgView.snp.makeConstraints { (make) in
            make.centerY.height.equalToSuperview()
            make.right.equalToSuperview().offset(-8)
            make.left.equalToSuperview().offset(8)
        }
        bgView.addSubview(ReviewName)
        bgView.addSubview(ReviewTime)
        bgView.addSubview(ReviewMember)
        bgView.addSubview(ReviewState)
        
        ReviewName.textColor = UIColor(hexString: "#040000")
        ReviewTime.textColor = UIColor(hexString: "#888888")
        ReviewMember.textColor = UIColor(hexString: "#b2b2b2")
        ReviewState.textColor = UIColor(hexString: "#2683f5")
        
        ReviewName.font = UIFont.init(name: "PingFang SC", size: 18)
        ReviewTime.font = UIFont.init(name: "PingFang SC", size: 14)
        ReviewMember.font = UIFont.init(name: "PingFang SC", size: 14)
        ReviewState.font = UIFont.init(name: "PingFang SC", size: 14)
        
        ReviewName.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(20)
            make.top.equalToSuperview().offset(11)
        }
        ReviewTime.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-19)
            make.centerY.equalTo(ReviewName)
        }
        ReviewMember.snp.makeConstraints { (make) in
            make.left.equalTo(ReviewName.snp.left)
            make.bottom.equalToSuperview().offset(-11)
        }
        ReviewState.snp.makeConstraints { (make) in
            make.right.equalTo(ReviewTime.snp.right)
            make.bottom.equalTo(ReviewMember.snp.bottom)
        }
        
    }
    
    func setText(modle:MyReviewModle){
        ReviewName.text = modle.name
        ReviewTime.text = modle.time + "截止"
        ReviewMember.text = "指派人: " + modle.member
        ReviewState.text = modle.state.rawValue
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
